<?php
	require_once($_SERVER['DOCUMENT_ROOT'].'uno-course-scheduler/include/config.inc.php');
	require_once($_SERVER['DOCUMENT_ROOT'].'uno-course-scheduler/include/top.inc.php');

//get num_rows currently in buildings table
$building_id = mysql_real_escape_string(strip_tags($_POST['bid']));
$classroom_id = mysql_real_escape_string(strip_tags($_POST['id']));

$get_building_data = mysql_query("SELECT * FROM buildings WHERE id = $building_id");
$building_name = mysql_result($get_building_data,0,'building_name');
$abbreviation = mysql_result($get_building_data,0,'abbreviation');

$get_classroom_data = mysql_query("SELECT * FROM classrooms WHERE id = $classroom_id");
$room_num = mysql_result($get_classroom_data,0,'room_num');

echo "<h1>Delete Classroom in $building_name</h1>";

$query = "DELETE FROM classrooms WHERE id='$classroom_id'";
$result = mysql_query($query);

if ($result)
{
	echo "<b>".stripslashes($abbreviation)." ".stripslashes($room_num)."</b> has been successfully deleted!";
	echo "<br />";
}
else
{
	echo "<b>".stripslashes($abbreviation)." ".stripslashes($room_num)."</b> was NOT able to be deleted at this time!";
	echo "<br />";
}

//close
mysql_close();

echo "<p>";
	echo "<a href='index.php?id=$building_id'>&lt;&lt; Back to Classrooms Portal</a><br />";
echo "</p>";
?>

<?php
	require_once($_SERVER['DOCUMENT_ROOT'].'uno-course-scheduler/include/bottom.inc.php');
?>